﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/

using System;
using System.Collections;
using System.Collections.Generic;
using NHibernate;
using Spring.Data.NHibernate.Support;

using VisualAgile.IDAL;
using VisualAgile.Model;
using Spring.Data.NHibernate;
using NHibernate.Engine;

namespace VisualAgile.DAL
{
    public class ProjectDao : BaseDao<Project>, IProjectDao
    {
        protected override HibernateTemplate getBaseDAO()
        {
            return HibernateTemplate;
        }

        public Project FindByName(string projectName)
        {
            IList project = HibernateTemplate.Find("from Project where Name = ?", projectName);

            if (project != null && project.Count > 0)
                return project[0] as Project;
            
            return null;
        }        
    }
}
